<?php

namespace App\Admin\Extensions;
use Dcat\Admin\Widgets\Modal;
use App\Admin\Controllers\UserController;
use App\Admin\Controllers\UserBingshiController;
use App\Admin\Controllers\UserDanganController;
use App\Admin\Controllers\UserWenjuanController;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Tab;

class AddUser {
    public function __construct(){

    }
    public function render()
    {
        $url = admin_url('users');
        $modal = Modal::make()
        ->title('新增客户')
        ->body($this->view())
        ->xl()
        ->onShow(<<<JS
$('input[name=name]').parents('form').attr('action', '{$url}')
JS
        )
        ->footer('<button class="btn btn-primary">提交</button>')
        ->button('<button class="btn btn-primary">新增客户</button>');
        return $modal->render();
    }

    public function userForm(){
        Admin::translation('user');
        return app()->make(UserController::class)->form(-1);
    }

    

    public function view(){
        return $this->userForm();
    }
}